package com.mybatis.dao;


import com.mybatis.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface UserMapper {
   @Select("select * from user")
  List<User> getUsers();
   //方法存在多个参数，必须加上@Param
   @Select("select * from user where id = #{id}")
   User getUserById(@Param("id") int id);
   //add一条记录
    @Insert("insert into user (id,name,pwd) values (#{id},#{name},#{password})")
    int addUser(User user);
    //update一条记录
    @Update("update user set name=#{name},pwd=#{password} where id = #{id}")
    int updateUser(User user);
    //删除一条记录
    @Delete("delete from user where id = #{id}")
    int deleteUser(@Param("id") int id);
}
